<template>
  <div id="my-markdown" class="markdown-body">
    <vue-markdown :source="md"></vue-markdown>
  </div>
</template>

<script>
import VueMarkdown from "vue-markdown";
export default {
  data() {
    return {
      md: ""
    };
  },
  components:{
    VueMarkdown
  },
  created() {
    // 从后端请求README.md
    this.$axios
      .get("/public/docs/README.md", {})
      .then(res => {
        this.md = res;
      })
      .catch(err => {
        return Promise.reject(err);
      });
  }
};
</script>

<style>
@import "~assets/css/github-markdown.css";
.markdown-body {
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0 40px;
}
</style>